package com.example.springboot.controller;

import com.example.springboot.beans.Student;
import com.example.springboot.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StuController {
    @Autowired
    private StudentMapper studentMapper;
        @GetMapping("/student")
    public String stu(){
        Student stu1= studentMapper.getStudentById(1);
        int r1=  studentMapper.deleteStudentById(5);
        Student stu=new Student();
        stu.setName("rtw");
        stu.setAge(20);
        int r2=  studentMapper.insertStudent(stu);
        stu.setAddress("ppppppppppppppppppppppppppppppppppp");
        stu.setId(6);
        int r3= studentMapper.updateStudent(stu);
        return stu1.toString()+r1+"-"+r2+"-"+r3;
    }
}
